package com.fullstack.landscape.editor.config;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;

import javax.sql.DataSource;

/**
 * @author leven.chen
 * @project tms-gt-be
 * @date 2018/9/11 15:42
 * @apiNote
 */
@Configuration
@MapperScan(basePackages = "com.fullstack.landscape.editor.dao")
public class MybatisConfig {

    @Bean
    @Primary
    public PlatformTransactionManager transactionManager(DataSource dataSource) {
        return new DataSourceTransactionManager(dataSource);
    }

}
